//
//  MSSelectRemindTableVC.m
//  SocietySale
//
//  Created by Mike on 16/11/18.
//  Copyright © 2016年 Mike. All rights reserved.
//

#import "MSSelectRemindTableVC.h"
#import "MSProjectRadarCell.h"

@interface MSSelectRemindTableVC ()

@end

@implementation MSSelectRemindTableVC

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *cellId = @"cellId";
    MSProjectRadarCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[MSProjectRadarCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellId];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    if (indexPath.row == [self.dataArray count]-1) {
        cell.horizonLineView.hidden = YES;
    }
    else{
        cell.horizonLineView.hidden = NO;
    }
    if ([self.stateArray[indexPath.row] isEqualToString:@"y"]) {
        cell.tagImage.hidden = NO;
    }
    else{
        cell.tagImage.hidden = YES;
    }
    cell.valueStr = self.dataArray[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    MSProjectRadarCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.tagImage.hidden = [self.stateArray[indexPath.row] isEqualToString:@"y"];

    NSString *stateStr = [self.stateArray[indexPath.row] isEqualToString:@"y"]?@"n":@"y";
    [self.stateArray replaceObjectAtIndex:indexPath.row withObject:stateStr];
}

//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
//    return 50;
//}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 10.0f;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENFRAME.size.width, 20)];
    bgView.backgroundColor = kDefaultViewBackgroundColor;
    
    UIView *horizonLineView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0.6)];
    horizonLineView.backgroundColor = kNormalGray;
    [bgView addSubview:horizonLineView];
    return bgView;
}

@end
